#pragma once
#include "Ship.h"
#include "Vector.h"
#include <functional>

namespace dxroids
{
   class PlayerShip : public Ship
   {

   public:

      PlayerShip(Vector const & _pos, float _bounding_radius = 50.0f, float _scale = 1.0f);      

      void RotateLeft();
      void RotateRight();
      void StopRotate();

      void EngageHyperspace();

      virtual std::unique_ptr<GameObject> Destroy(std::shared_ptr<SoundManager> const & _sound_manager) override;      

   protected:

      PlayerShip(Vector const & _pos, float _bounding_radius, float _scale, Ship::Attributes const & _attrs);

      virtual DXROIDS_COM_PTR<ID2D1Geometry> CreateShipGeometry(
         DXROIDS_COM_PTR<ID2D1Factory> const & _factory, float _scale) override;

      virtual DXROIDS_COM_PTR<ID2D1Geometry> CreateThrustGeometry(
         DXROIDS_COM_PTR<ID2D1Factory> const & _factory, float _scale) override;

   private:

      bool inHyperSpace_;
   };


   // for noah
   class NoahsShip : public PlayerShip
   {

   public:

      NoahsShip(Vector const & _pos, float _scale = 1.0f);

   protected:
     
      virtual DXROIDS_COM_PTR<ID2D1Geometry> CreateShipGeometry(
         DXROIDS_COM_PTR<ID2D1Factory> const & _factory, float _scale) override;

      virtual DXROIDS_COM_PTR<ID2D1Geometry> CreateThrustGeometry(
         DXROIDS_COM_PTR<ID2D1Factory> const & _factory, float _scale) override;

      virtual Vector GetNextShotPosition() const override;

   private:

      mutable int shot_number_;

   };
} 

inline void dxroids::PlayerShip::StopRotate()
{
   SetRotationalVelocity(0.0f);
}

inline void dxroids::PlayerShip::RotateLeft()
{
   SetRotationalVelocity(-DXROIDS_PLAYER_SHIP_ROTATIONAL_VELOCITY);
}

inline void dxroids::PlayerShip::RotateRight()
{
   SetRotationalVelocity(DXROIDS_PLAYER_SHIP_ROTATIONAL_VELOCITY);
}

